import React from 'react'
import styles from '../index.module.css'

// 医院数据接口
export interface HospitalData {
  id?: number
  nosocomium?: string  // 医院名称
  hospitalName?: string
  sococity?: string    // 医院地址
  location?: string
  socolv?: string      // 医院等级
  socostate?: string
  socoadmin?: string
  phone?: string
  contact?: string
  socoimage?: string   // 医院图片
  hospitalLogo?: string
  description?: string
  departments?: string
  rating?: number
  reviewCount?: number
  distance?: string
  isOpen?: boolean
  services?: string[]
  [key: string]: any
}

interface HospitalCardProps {
  hospital: HospitalData
  index: number
}

const HospitalCard: React.FC<HospitalCardProps> = ({ hospital }) => {

  // 处理医院名称
  const hospitalName = hospital.nosocomium || hospital.hospitalName || '医院名称'
  
  // 处理医院地址
  const hospitalAddress = hospital.sococity || hospital.location || '医院地址'
  
  
  // 处理医院图片
  const hospitalImage = hospital.socoimage || hospital.hospitalLogo || '/default-hospital.png'

  const handleHospitalClick = () => {
    // 可以导航到医院详情页
    console.log('点击医院:', hospital)
    // navigate(`/hospital/${hospital.id}`)
  }

  return (
    <div className={styles.hospitalCard} onClick={handleHospitalClick}>
      <div className={styles.hospitalImage}>
        <img src={hospitalImage} alt={hospitalName} />
      </div>
      
      <div className={styles.hospitalInfo}>
        <h3 className={styles.hospitalName}>{hospitalName}</h3>
        
        <p className={styles.hospitalAddress}>
           {hospitalAddress}
        </p>
        
   
      
        
       
      </div>
  
    </div>
  )
}

export default HospitalCard
